using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MalwareMultiScan.Backends.Interfaces;

namespace MalwareMultiScan.Backends.Backends.Implementations
{
    /// <inheritdoc />
    public class DummyScanBackend : IScanBackend
    {
        /// <inheritdoc />
        public string Id { get; } = "dummy";

        /// <inheritdoc />
        public Task<string[]> ScanAsync(string path, CancellationToken cancellationToken)
        {
            return Scan();
        }

        /// <inheritdoc />
        public Task<string[]> ScanAsync(Uri uri, CancellationToken cancellationToken)
        {
            return Scan();
        }

        /// <inheritdoc />
        public Task<string[]> ScanAsync(Stream stream, CancellationToken cancellationToken)
        {
            return Scan();
        }

        private static async Task<string[]> Scan()
        {
            await Task.Delay(
                TimeSpan.FromSeconds(5));

            return new[] {"Malware.Dummy.Result"};
        }
    }
}